<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312"/>
    <style type="text/css">
        ._color_{padding: 0;margin: 0;}
        ._color_ li{list-style: none;float: left;}
        ._color_:after{display: block;clear: both;content: ' '}
    </style>
</head>
<body>
<script type="text/javascript">
    (function () {
        var Color = function () {
            var base_hexa = "0123456789ABCDEF";
            function dec2Hexa(number) {
                return base_hexa.charAt(Math.floor(number / 16)) + base_hexa.charAt(number % 16);
            }
            function RGB2Hexa(TR, TG, TB) {
                return "#" + dec2Hexa(TR) + dec2Hexa(TG) + dec2Hexa(TB);
            }
            function lightCase(MyObject, objName) {
                MM_findObj(objName).bgColor = MyObject.bgColor;
            }
            var col = [];
            col[0] = new Array(255, 0, 255, -1, 255, -1);
            col[1] = new Array(255, 0, 0, 1, 0, 0);
            col[2] = new Array(255, -1, 255, 0, 0, 0);
            col[3] = new Array(0, 0, 255, 0, 0, 1);
            col[4] = new Array(0, 0, 255, -1, 255, 0);
            col[5] = new Array(0, 1, 0, 0, 255, 0);
            col[6] = new Array(255, -1, 0, 0, 255, -1);
            this.render = function ( w, h) {
                var html = '<ul class="_color_">';
                var pas = 36;
                for (j = 0; j < 6 + 1; j++) {
                    for (i = 0; i < pas + 1; i++) {
                        var r = Math.floor(col[j][0] + col[j][1] * i * (255) / pas);
                        var g = Math.floor(col[j][2] + col[j][3] * i * (255) / pas);
                        var b = Math.floor(col[j][4] + col[j][5] * i * (255) / pas);
                        html+='<li style="background-color: {bgColor};height:{height}px;width:{width}px;"></li>'
                                .replace("{bgColor}", RGB2Hexa(r, g, b))
                                .replace("{width}",w)
                                .replace("{height}",h);
                    }
                }
                html+='</ul>';
                return html;
            };
            return this;
        }
        window.Color = Color;
    })();
    
</script>
<div id="ul"></div>
<div>
    <script>
        var html =new Color().render(1,18);
        document.getElementById("ul").innerHTML = html;
    </script>
</div>
</body>
</html>
